\[\hat{Y} = b_0 + b_1 X_1 + b_2 X_2\]
\[\hat{Y} = b_0 + b_1 X_1 + b_2 X_2 + b_3 X_1 X_2\]
\[\hat{Y} = (\color{red}{b_0 + b_2 X_2}) + (\color{blue}{b_1 + b_3 X_2}) X_1\]
tl;dr: It’s really super complicated and isn’t a single value
The interaction is conditional on values of both \(X_1\) and \(X_2\)
What to do?
tl;dr: Maybe, but also maybe not
The product term is neither necessary nor sufficient to determine whether there’s an interaction
Compare a model with a product term to a model without a product term
Two continuous predictors: \[\beta_{3} \dot{g}^{-1}(d(x)^T \beta + (\beta_1 + \beta_3 X_2)(\beta_2 + \beta_3 X_1) \ddot{g}^{-1}(d(x)^T \beta) \]
One continuous, one categorical predictor: \[(\beta_2 + \beta_3) \dot{g}^{-1}((\beta_2 + \beta_3) X_2 + \beta_0 + \beta_1) - \beta_2 \dot{g}^{-1}(\beta_0 + \beta_2 X_2)\]
Two categorical predictors: \[\dot{g}^{-1}(\beta_0 + \beta_1 + \beta_2 + \beta_3) - \dot{g}^{-1}(\beta_0 + \beta_1) - \dot{g}^{-1} (\beta_0 + \beta_2) + \dot{g}^{-1}(\beta_0)\]
Notice that the interaction is a function of a bunch of things: \(\beta_1\), \(\beta_2\), \(\beta_3\), as well as other covariates in the model (\(\beta\))
There are also first and second derivatives of the inverse link function
Conditional effects = simple slopes
With the caveat that, for GLiMs, they are also conditional on the predictor
As we’ve already seen for GLiMs
case: Subject IDsensation: Sensation seeking (1 to 7)gender: 0 = female, 1 = maley: Number of alcoholic beverages consumed on Saturday nightCoxe, S., West, S. G., & Aiken, L. S. (2009). The analysis of count data: A gentle introduction to Poisson regression and its alternatives. Journal of Personality Assessment, 91(2), 121-136.
Call:
glm(formula = y ~ sensation4 + gender, family = poisson(link = "log"),
data = jpa)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.3696 -1.5739 -0.4401 0.8383 3.8439
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.25455 0.07434 3.424 0.000617 ***
sensation4 0.26085 0.03882 6.719 1.83e-11 ***
gender 0.83947 0.06292 13.342 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 1186.76 on 399 degrees of freedom
Residual deviance: 959.46 on 397 degrees of freedom
AIC: 1888.8
Number of Fisher Scoring iterations: 5
sensation4*gender)
Call:
glm(formula = y ~ sensation4 + gender + gender * sensation4,
family = poisson(link = "log"), data = jpa)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.4817 -1.7195 -0.5326 0.8161 3.7184
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 0.46454 0.10909 4.258 2.06e-05 ***
sensation4 0.10318 0.07412 1.392 0.1639
gender 0.55540 0.12950 4.289 1.80e-05 ***
sensation4:gender 0.21434 0.08694 2.465 0.0137 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 1186.76 on 399 degrees of freedom
Residual deviance: 953.47 on 396 degrees of freedom
AIC: 1884.8
Number of Fisher Scoring iterations: 5
\[\hat{\mu} = e^{(\color{red}{0.465 + 0.555 gender}) + (\color{blue}{0.103 + 0.214 gender}) sensation4}\]
gender = 0
\[ln(\hat{\mu}) = e^{(\color{red}{0.465 + 0.555 gender}) + (\color{blue}{0.103 + 0.214 gender}) sensation4}\]
gender = 0
gender = 1
sensation4 = 0 (sensation = 4):
gender = 0: Predicted count = 1.59gender = 1: Predicted count = 2.77sensation4 = 1 (sensation = 5):
gender = 0: Predicted count = 1.76gender = 1: Predicted count = 3.81sensation4 = 2 (sensation = 6):
gender = 0: Predicted count = 1.96gender = 1: Predicted count = 5.23| sensation4 | gender | Predicted count |
|---|---|---|
| 0 | 0 | 1.591 |
| 1 | 0 | 1.764 |
| 2 | 0 | 1.956 |
| 0 | 1 | 2.773 |
| 1 | 1 | 3.809 |
| 2 | 1 | 5.233 |
McCabe, C. J., Halvorson, M. A., King, K. M., Cao, X., & Kim, D. S. (2020). Interpreting interaction effects in generalized linear models of nonlinear probabilities and counts. Multivariate Behavioral Research, 1-27. doi: https://doi.org/10.1080/00273171.2020.1868966
I have not been able to get this to work for this dataset, but it does work with the simulated data they provide
a path: \[\hat{M} = i_{MX} + aX\]
b and c’ paths: \[\hat{Y} = i_{YXM} + bM + c'X\]
c path: \[\hat{Y} = i_{YX} + cX\]
Slopes are the first derivative of their respective equations
In linear regression, slopes simplify to \(a\) and \(b\)
In GLiMs, slopes are more complex
| Model | Model equation | First derivative |
|---|---|---|
| Linear | \(\hat{M} = i + aX\) | \(a\) |
| Poisson | \(\hat{M} = e^{(i + aX)}\) | \(a e^{(i + a X)}\) |
| Logistic | \(\hat{M} = \frac{e^{(i + aX)}}{1 + e^{(i + aX)}}\) | \(\frac{a e^{(i + a X)}}{(1 + e^{(i + a X)})^2}\) |
| Model | Model equation | First derivative |
|---|---|---|
| Linear | \(\hat{Y} = i + bM + c'X\) | \(b\) |
| Poisson | \(\hat{Y} = e^{(i + bM + c'X)}\) | \(b e^{(i + bM + c'X)}\) |
| Logistic | \(\hat{Y} = \frac{e^{(i + bM + c'X)}}{1 + e^{(i + bM + c'X)}}\) | \(\frac{b e^{(i + bM + c'X)}}{(1 + e^{(i + bM + c'X)})^2}\) |
gender to sensation(Intercept) gender
1.242024 -0.118866
gender to sensationsensation to y (drinks)(Intercept) sensation4 gender
0.2545520 0.2608472 0.8394682
sensation to y (drinks)gender) and \(M\) (sensation4)
x m ind
1 0 1.242024 -0.05529634
2 1 1.123158 -0.12411010
gender to y (drinks) via sensation4
gender = 0)gender = 1)